#include "command.h"

int _help(char *argv[])
{
	/* check the number of cmd-line parameters is correct */
	int argc = 0;
	for (char **ptr = argv; *ptr != NULL; ptr++)
		argc++;
	if (argc != 1) {
		fprintf(stderr, "Usage: help\n");
		return -1;
	}

	printf("\n\t%s----- COMMAND HELP -----%s\n", CYAN, RESET);
	printf("\t%scopy:%s       Copy files.\n", YELLOW, RESET);
	printf("\t%shi:%s         Print welcome message.\n", YELLOW, RESET);
	printf("\t%sclear:%s      Clear screen.\n", YELLOW, RESET);
	printf("\t%sprintenv:%s   Print environment variables.\n", YELLOW, RESET);
	printf("\t%smoverect:%s   A boring game, moving the rectangle with arrow keys.\n", YELLOW, RESET);
	printf("\t%shelp:%s       Help for joky command.\n", YELLOW, RESET);
	printf("\t%ssysinfo:%s    Print system infomation simply\n", YELLOW, RESET);
	printf("\t%sls:%s         List files and directories.\n", YELLOW, RESET);
	printf("\t%spwd:%s        Print working directory.\n", YELLOW, RESET);
	printf("\t%scd:%s         Change directory.\n", YELLOW, RESET);
	printf("\t%sexit:%s       Exit joky.\n", YELLOW, RESET);
	printf("\t%stee:%s        Read input and write it to the given file.\n", YELLOW, RESET);
	printf("\t%shead:%s       Print the first N lines of file(default N=10).\n", YELLOW, RESET);
	printf("\t%stail:%s       Print the last N lines of file(default N=10).\n", YELLOW, RESET);
	printf("\t%skilo:%s       A editor named kilo.\n", YELLOW, RESET);
	printf("\t%stouch:%s      Create files.\n", YELLOW, RESET);
	printf("\t%secho:%s       Print string to screen.\n", YELLOW, RESET);
	printf("\t%scat:%s        Print the whole content of file.\n", YELLOW, RESET);
	printf("\t%smkdir:%s      Create a directory.\n", YELLOW, RESET);
	printf("\t%srmdir:%s      Remove a empty directory.\n", YELLOW, RESET);
	printf("\t%srm:%s         Remove a file or recursively remove a direcoty.\n", YELLOW, RESET);
	printf("\t%smv:%s         Move a file or directory to another place or just rename it.\n", YELLOW, RESET);
	printf("\t%sln:%s         Create a symbolic link or hard link.\n", YELLOW, RESET);
	printf("\t%shistory:%s    Print the history commands.\n", YELLOW, RESET);
	printf("\t%stree:%s       Print the directory tree.\n", YELLOW, RESET);

	printf("\n\t%s----- KEY HELP -----%s\n", CYAN, RESET);
	printf("\t%sCtrl+P:%s     Previous command.\n", YELLOW, RESET);
	printf("\t%sCtrl+N:%s     Next command.\n", YELLOW, RESET);
	printf("\t%sCtrl+L:%s     Clear the screen.\n", YELLOW, RESET);
	printf("\t%sCtrl+U:%s     Abort current input.\n", YELLOW, RESET);
	printf("\t%sCtrl+A:%s     Move cursor to the beginning of input.\n", YELLOW, RESET);
	printf("\t%sCtrl+E:%s     Move cursor to the end of input.\n", YELLOW, RESET);
	printf("\t%sCtrl+B:%s     Move cursor left.\n", YELLOW, RESET);
	printf("\t%sCtrl+F:%s     Move cursor right.\n", YELLOW, RESET);
	printf("\t%sCtrl+D:%s     Delete the current character.\n", YELLOW, RESET);
	printf("\t%sBACKSPACE:%s  Move cursor back one space.\n", YELLOW, RESET);
	printf("\t%sTAB:%s        Complete current input(for files only).\n", YELLOW, RESET);

	printf("\n");

	return 0;
}
